package com.ymatou.iapi.trading.operate.testcase;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.json.JSONArray;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.trading.operate.parameter.ActivityVo;
import com.ymatou.iapi.trading.operate.parameter.OrderGroupVo;
import com.ymatou.iapi.trading.operate.parameter.OrderItemVo;
import com.ymatou.iapi.trading.operate.parameter.OrderVo;
import com.ymatou.iapi.trading.operate.parameter.PlaceOrderResp;
import com.ymatou.iapi.trading.operate.parameter.PlaceOrderService;
import com.ymatou.iapi.trading.operate.parameter.enums.ActivityPromotionTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.AppTerminalSourceEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.LogisticsTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.OrderSourceEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.OrderTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.PlatformEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.PriceTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.ProductRefundChannelEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.SalesTypeEnum;
import com.ymatou.iapi.trading.operate.parameter.enums.TerminalSourceEnum;
import com.ymatou.iapi.trading.operate.parameter.req.GetOrderGroupInfosReq;
import com.ymatou.iapi.trading.operate.parameter.req.PlaceOrderReq;
import com.ymatou.iapi.trading.operate.parameter.resp.GetOrderGroupInfosResp;
import com.ymatou.iapi.trading.operate.parameter.resp.OrderGroupExtPo;
import com.ymatou.iapi.trading.operate.parameter.resp.OrderInfo;
import com.ymatou.iapi.trading.operate.parameter.resp.ProductInfo;
import com.ymatou.iapi.trading.operate.service.GetOrderGroupInfosCall;
import com.ymatou.iapi.trading.operate.service.PlaceOrderCall;
import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.business.service.OrderCallService;
import com.ymttest.business.service.ProductCallService;
import com.ymttest.common.enums.CancelOrderTypeEnum;
import com.ymttest.database.sqlwapper.DefaultWapper;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

/**
 *  支付之前查询主单信息(防止买家查询服务异常,导致无法下单支付)
 */
@TestSuite
public class Ts_GetOrderGroupInfos {

	private static GetOrderGroupInfosReq req;
	private static GetOrderGroupInfosCall getOrderGroupInfosCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("支付之前查询主单信息");
	}

	@Before
	public void caseUp() {
		req = new GetOrderGroupInfosReq();
		getOrderGroupInfosCall = new GetOrderGroupInfosCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getOrderGroupInfosCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	private GetOrderGroupInfosResp constructExpectedResult() {

		GetOrderGroupInfosResp resp = new GetOrderGroupInfosResp();

		List<OrderGroupExtPo> list;
		try {
			list = new DefaultWapper().getGroupOrderInfoByMainOrderId(
					req.getOrderGroupId(), req.getUserId());

			Map<Long, OrderInfo> map = new HashMap<Long, OrderInfo>();

			for (OrderGroupExtPo po : list) {
				if (!map.containsKey(po.getOrderId())) {

					OrderInfo orderInfo = new OrderInfo();

					orderInfo.setOrderId(po.getOrderId());
					orderInfo.setSellerId(po.getSellerId());
					orderInfo.setReceiver(po.getReceiver());

					orderInfo.setPayableAmount(po.getPayableAmount());

					orderInfo.setPlatform(PlatformEnum.getPlatformEnumInfo(
							po.getOrderSource()).getValue());
					orderInfo.setProducts(new ArrayList<ProductInfo>());
					map.put(po.getOrderId(), orderInfo);
					resp.setTradingId(po.getTradingId());
				}

				ProductInfo productInfo = new ProductInfo();
				productInfo.setLogisticsType(po.getLogisticsType());

				map.get(po.getOrderId()).getProducts().add(productInfo);
			}
			resp.setOrderInfos(map.values().stream()
					.collect(Collectors.toList()));

		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return resp;
	}

	/**
	 * 一个订单下面多个商品, 老买手，新用户
	 * 
	 * 一单所在日期之后的其他订单（同一买家在该买手店铺支付完成的订单）为该买手的老客订单
	 */
	private Map placeOrder6() {
		Map map = new HashMap();
		try {
			PlaceOrderReq placeorderBean = new PlaceOrderReq();
			PlaceOrderCall placeorderCall = new PlaceOrderCall();
			// 注册新用户
			Map newUser = new HashMap();

			UserRegisterInfoRequestDtoBean urb = new JUserCallService()
					.initUserRegisterInfoRequestDtoBean();

			int userId = new JUserCallService().UserRegisterInfoRequestDtoCall(
					urb).getUserid();

			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			// 创建产品
			Logger.comment("前置数据准备");
			HashMap<String, Object> productInfo = ProductCallService
					.createProduct(sellerId, 3);
			Logger.comment("前置数据准备结束");
			String productId = (String) productInfo.get("productId");
			Logger.debug("productId:" + productId);
			String productName = (String) productInfo.get("productName");
			String pic = (String) productInfo.get("pic");
			BigDecimal price = (BigDecimal) (productInfo.get("price"));
			String catalogId = (String) productInfo.get("catalogId");

			placeorderBean.setAppId("AutoTest");
			placeorderBean.setUserId(userId);
			placeorderBean.setRequestId(TestDataManager.getRandomUUID()
					.toString());
			placeorderBean.setTerminalSource(TerminalSourceEnum.IOS);
			placeorderBean.setAppTerminalSource(AppTerminalSourceEnum.Phone);
			placeorderBean.setSourceIp("127.0.0.1");
			placeorderBean.setAppId("ios");
			placeorderBean.setDeviceId("7777777777888888888888999");
			OrderGroupVo groupVo1 = new OrderGroupVo();
			placeorderBean.setOrderSource(OrderSourceEnum.PC);

			groupVo1.setSellerId(sellerId);
			List<OrderVo> orders = new ArrayList<OrderVo>();
			OrderVo ordervo1 = new OrderVo();
			ordervo1.setAutoCancelOrderHours(new BigDecimal(1));
			ordervo1.setOrderType(OrderTypeEnum.Spot);
			ordervo1.setPaidFull(true);
			ordervo1.setAddress("上海市闸北区灵石路636号");
			ordervo1.setLeaveWord("ymt autotest");
			ordervo1.setPhone("13100000001");
			ordervo1.setPostCode("200001");
			ordervo1.setTelephone("021-51002100");
			ordervo1.setReceiveName("李四");
			List<OrderItemVo> items = new ArrayList<OrderItemVo>();
			OrderItemVo orderitem1 = new OrderItemVo();
			orderitem1.setCatalogId(TestDataManager.getRandomUUID().toString());
			orderitem1.setProductNum(3);
			orderitem1.setProductName(productName);
			orderitem1.setPriceType(PriceTypeEnum.VipPrice);
			orderitem1.setFirstCategoryId(1149);
			orderitem1.setProductId(TestDataManager.getRandomUUID().toString());
			orderitem1.setFirstCategoryId(1149);
			orderitem1.setSecondCategoryId(22222);
			orderitem1.setThirdCategoryId(33333);
			price = new BigDecimal(21);
			orderitem1.setEarnestPrice(price);
			orderitem1.setProductPrice(price);
			orderitem1.setOriginalPrice(price);
			orderitem1.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem1.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1.setBrandId(5);
			orderitem1.setPackageNo("11111111");
			orderitem1
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem1.setProductRecordNo("1234567");
			orderitem1
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem1
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			ActivityVo activity = new ActivityVo();
			activity.setActivityId(46870);
			activity.setActivityBeginDate(YMTDateUtil.getBeforeOrNextDay(-10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityEndDate(YMTDateUtil.getBeforeOrNextDay(10,
					"yyyy-MM-dd'T'HH:mm:ss"));
			activity.setActivityTemplateId(12345678);
			activity.setCommissionRate(new BigDecimal(1.1));
			activity.setCost(true);
			activity.setFeeFree(false);
			activity.setPremium(new BigDecimal(1.5));
			activity.setPromotionPrice(new BigDecimal(15));
			activity.setPromotionType(ActivityPromotionTypeEnum.DiscountRate);
			activity.setUseCoupon(true);
			orderitem1.setActivity(activity);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("21"));
			// 第2件商品
			OrderItemVo orderitem2 = new OrderItemVo();
			orderitem2.setCatalogId("edbcc2c9-1ba9-4b04-ab88-940f63271823");
			orderitem2.setProductNum(1);
			orderitem2.setProductName(productName);
			orderitem2.setPriceType(PriceTypeEnum.VipPrice);
			orderitem2.setProductId(TestDataManager.getRandomUUID().toString());
			orderitem2.setFirstCategoryId(1149);
			price = new BigDecimal(30);
			orderitem2.setEarnestPrice(price);
			orderitem2.setProductPrice(price);
			orderitem2.setOriginalPrice(price);
			orderitem2.setSalesType(SalesTypeEnum.AlreadyInStock);
			orderitem2.setLogisticsType(LogisticsTypeEnum.SailProtect);
			orderitem2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem2.setBrandId(5);
			orderitem2.setPackageNo("11111111");
			orderitem2.setFirstCategoryId(1149);
			orderitem2.setSecondCategoryId(22222);
			orderitem2.setThirdCategoryId(33333);
			orderitem2
					.setProductDetailInfo("e5a1eccf-6a14-458f-b907-35dc9a3d2713#适用人群:b13e9eb1-98d6-4d39-8c35-225758e443d3#男");
			orderitem2.setProductRecordNo("1234567");
			orderitem2
					.setProductRefundChannel(ProductRefundChannelEnum.Official);
			orderitem2
					.setProperty("06f25e0c-e431-44ae-8a07-4d0bc824e3bd#尺寸:951a814e-2ded-4241-b9a0-91b2cd9a44fd#6,d2f663ea-3214-4344-abce-a8eaffcc43ce#颜色:f3ed3ad7-a084-450b-b698-256542963306#红色");
			orderitem2.setActivity(activity);
			items.add(orderitem1);
			items.add(orderitem2);
			ordervo1.setOrderItems(items);
			ordervo1.setFreight(new BigDecimal("21"));
			orders.add(ordervo1);
			groupVo1.setOrders(orders);
			placeorderBean.setOrderGroups(Arrays.asList(groupVo1));
			placeorderCall.setData(false, placeorderBean);
			placeorderCall.callService();
			JSONArray orderIds = placeorderCall.getOrderIds();
			int tradingId2 = placeorderCall.getTradingId();
			map.put("userId", userId);
			map.put("sellerId", sellerId);
			map.put("orderIds", orderIds);
			map.put("tradingId", tradingId2);
		} catch (Exception e) {
			Logger.fail(e);
		}
		return map;
	}
	private void verify() {
		GetOrderGroupInfosResp expectResponse = constructExpectedResult();
		GetOrderGroupInfosResp actualResponse = getOrderGroupInfosCall
				.getBuyerGroupOrderInfosResp();

		List<OrderInfo> expectOrders = expectResponse.getOrderInfos();
		List<OrderInfo> actualOrders = actualResponse.getOrderInfos();

		for (int i = 0; i < expectOrders.size(); i++) {

			OrderInfo expect = expectOrders.get(i);
			OrderInfo actual = actualOrders.get(i);

			Logger.verifyEquals(expect.getOrderId(), actual.getOrderId(), "订单号");

			Logger.verifyEquals(expect.getPlatform(), actual.getPlatform(),
					"platform");

			Logger.verifyEquals(expect.getSellerId(), actual.getSellerId(),
					"sellerId");

			DataUtil.verifyDecimalEquals(expect.getPayableAmount(),
					actual.getPayableAmount(), "payableAmount");

			/*			Logger.verifyEquals(expect.getLastPayTime(),
								actual.getLastPayTime(), "lastPayTime");*/

			Logger.verifyEquals(expect.getReceiver(), actual.getReceiver(),
					"receiver");

			/*			Logger.verifyEquals(expect.getNeedUploadIdCard(),
								actual.getNeedUploadIdCard(), "needUploadIdCard");*/

			List<ProductInfo> expectProductInfo = expect.getProducts();
			List<ProductInfo> actualProductInfo = actual.getProducts();

			for (int j = 0; j < expectProductInfo.size(); j++) {

				Logger.verifyEquals(
						expectProductInfo.get(j).getLogisticsType(),
						expectProductInfo.get(j).getLogisticsType(),
						"logisticsType");
			}

		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderGroupInfos_001() {
		Logger.start(true, "订单状态为1 下单,根据主单号获取订单详情");
		try {

			PlaceOrderResp placeOrderResp = PlaceOrderService
					.placeOrderWithOutCoupon();

			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			req.setUserId(userId);
			req.setOrderGroupId(tradingId);
			req.setNeedAccountAmount(false);

			getOrderGroupInfosCall.setData(req);
			getOrderGroupInfosCall.callService();

			Logger.verifyEquals("200", getOrderGroupInfosCall.getCode(), "code");
			Logger.verifyEquals(0, getOrderGroupInfosCall.getBCode(), "bcode");

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderGroupInfos_002() {
		Logger.start(true, "订单状态为2 付款,根据主单号获取订单详情");
		try {
			PlaceOrderResp placeOrderResp = PlaceOrderService.payOrder();
			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			req.setUserId(userId);
			req.setOrderGroupId(tradingId);

			getOrderGroupInfosCall.setData(req);
			getOrderGroupInfosCall.callService();

			Logger.verifyEquals("200", getOrderGroupInfosCall.getCode(), "code");
			Logger.verifyEquals(0, getOrderGroupInfosCall.getBCode(), "bcode");

			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderGroupInfos_003() {
		Logger.start(true, "订单状态为3 取消订单,根据主单号获取订单详情");
		try {

			PlaceOrderResp placeOrderResp = PlaceOrderService
					.cancelOrderAfterPaid(CancelOrderTypeEnum.BuyerCancelOrder);

			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			req.setUserId(userId);
			req.setOrderGroupId(tradingId);

			getOrderGroupInfosCall.setData(req);
			getOrderGroupInfosCall.callService();

			Logger.verifyEquals("200", getOrderGroupInfosCall.getCode(), "code");
			Logger.verifyEquals(0, getOrderGroupInfosCall.getBCode(), "bcode");

			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderGroupInfos_004() {
		Logger.start(true, "订单状态为 接单,根据主单号获取订单详情");
		try {
			PlaceOrderResp placeOrderResp = PlaceOrderService.acceptOrder();

			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			req.setUserId(userId);
			req.setOrderGroupId(tradingId);

			getOrderGroupInfosCall.setData(req);
			getOrderGroupInfosCall.callService();

			Logger.verifyEquals("200", getOrderGroupInfosCall.getCode(), "code");
			Logger.verifyEquals(0, getOrderGroupInfosCall.getBCode(), "bcode");

			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderGroupInfos_005() {
		Logger.start(true, "订单状态为 发货,根据主单号获取订单详情");
		try {
			PlaceOrderResp placeOrderResp = PlaceOrderService.dispatchedOrder();

			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			req.setUserId(userId);
			req.setOrderGroupId(tradingId);

			getOrderGroupInfosCall.setData(req);
			getOrderGroupInfosCall.callService();

			Logger.verifyEquals("200", getOrderGroupInfosCall.getCode(), "code");
			Logger.verifyEquals(0, getOrderGroupInfosCall.getBCode(), "bcode");

			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderGroupInfos_006() {
		Logger.start(true, "订单状态为 确认收货根据主单号获取订单详情");
		try {
			PlaceOrderResp placeOrderResp = PlaceOrderService
					.confirmReceiveOrder();

			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			req.setUserId(userId);
			req.setOrderGroupId(tradingId);

			getOrderGroupInfosCall.setData(req);
			getOrderGroupInfosCall.callService();

			Logger.verifyEquals("200", getOrderGroupInfosCall.getCode(), "code");
			Logger.verifyEquals(0, getOrderGroupInfosCall.getBCode(), "bcode");

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderGroupInfos_007() {
		Logger.start(true, "订单状态为1 下单,查询账户余额，根据主单号获取订单详情");
		try {

			PlaceOrderResp placeOrderResp = PlaceOrderService.payOrder();

			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			req.setUserId(userId);
			req.setOrderGroupId(tradingId);
			req.setNeedAccountAmount(true);

			getOrderGroupInfosCall.setData(req);
			getOrderGroupInfosCall.callService();

			Logger.verifyEquals("200", getOrderGroupInfosCall.getCode(), "code");
			Logger.verifyEquals(0, getOrderGroupInfosCall.getBCode(), "bcode");

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderGroupInfos_008() {
		Logger.start(true, "orderGroupId 为空");
		try {
			PlaceOrderResp placeOrderResp = PlaceOrderService
					.confirmReceiveOrder();

			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			req.setUserId(userId);
			//req.setOrderGroupId(tradingId);

			getOrderGroupInfosCall.setData(req);
			getOrderGroupInfosCall.callService();

			Logger.verifyEquals("400", getOrderGroupInfosCall.getCode(), "code");
			Logger.verifyEquals(100, getOrderGroupInfosCall.getBCode(), "bcode");
			Logger.verifyEquals("orderGroupId:主单号不能为0",
					getOrderGroupInfosCall.getMsg(), "msg");
			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderGroupInfos_009() {
		Logger.start(true, "userId 为空");
		try {
			PlaceOrderResp placeOrderResp = PlaceOrderService
					.confirmReceiveOrder();

			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			//req.setUserId(userId);
			req.setOrderGroupId(tradingId);

			getOrderGroupInfosCall.setData(req);
			getOrderGroupInfosCall.callService();

			Logger.verifyEquals("400", getOrderGroupInfosCall.getCode(), "code");
			Logger.verifyEquals(100, getOrderGroupInfosCall.getBCode(), "bcode");
			Logger.verifyEquals("userId:买家Id不能为0",
					getOrderGroupInfosCall.getMsg(), "msg");

			//verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderGroupInfos_010() {
		Logger.start(true, "needAccountAmount 为空");
		try {
			PlaceOrderResp placeOrderResp = PlaceOrderService
					.confirmReceiveOrder();

			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();

			req.setUserId(userId);
			req.setOrderGroupId(tradingId);

			getOrderGroupInfosCall.setData(req);
			getOrderGroupInfosCall.callService();

			Logger.verifyEquals("200", getOrderGroupInfosCall.getCode(), "code");
			Logger.verifyEquals(0, getOrderGroupInfosCall.getBCode(), "bcode");

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderGroupInfos_011() {
		Logger.start(true, "订单已支付");
		try {

			PlaceOrderResp placeOrderResp = PlaceOrderService.placeOrder3();

			int userId = placeOrderResp.getUserId();
			int tradingId = placeOrderResp.getTradingId();
			BigDecimal price = placeOrderResp.getPayAmount();

			new OrderCallService().orderPayRequest(userId, price, tradingId);

			req.setUserId(userId);
			req.setOrderGroupId(tradingId);
			req.setNeedAccountAmount(false);

			getOrderGroupInfosCall.setData(req);
			getOrderGroupInfosCall.callService();

			Logger.verifyEquals("200", getOrderGroupInfosCall.getCode(), "code");
			Logger.verifyEquals(0, getOrderGroupInfosCall.getBCode(), "bcode");

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderGroupInfos_012() {
		Logger.start(true, "新用户下单,根据主单号获取订单详情");
		try {

			// 创建订单
			Logger.comment("前置数据准备");
			Map map = placeOrder6();
			int userId = (Integer) map.get("userId");
			int sellerId = (Integer) map.get("sellerId");
			JSONArray orderIds = (JSONArray) map.get("orderIds");
			int tradingId = (Integer) map.get("tradingId");
			int orderId = orderIds.getInt(0);

			req.setUserId(userId);
			req.setOrderGroupId(tradingId);
			req.setNeedAccountAmount(true);

			getOrderGroupInfosCall.setData(req);
			getOrderGroupInfosCall.callService();

			Logger.verifyEquals("200", getOrderGroupInfosCall.getCode(), "code");
			Logger.verifyEquals(0, getOrderGroupInfosCall.getBCode(), "bcode");

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}
